home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Tcl-Tk 8.0 / Pre-installed version / tk8.0 / unix / configure.in next >
Encoding:
Text File  |  1997-08-15  |  13.7 KB  |  403 lines  |  [TEXT/ALFA]

  1. dnl    This file is an input file used by the GNU "autoconf" program to
  2. dnl    generate the file "configure", which is run during Tk installation
  3. dnl    to configure the system for the local environment.
  4. AC_INIT(../generic/tk.h)
  5. # SCCS: @(#) configure.in 1.87 97/08/07 10:33:08
  6.  
  7. TK_VERSION=8.0
  8. TK_MAJOR_VERSION=8
  9. TK_MINOR_VERSION=0
  10. TK_PATCH_LEVEL=""
  11. VERSION=${TK_VERSION}
  12.  
  13. if test "${prefix}" = "NONE"; then
  14.     prefix=/usr/local
  15. fi
  16. if test "${exec_prefix}" = "NONE"; then
  17.     exec_prefix=$prefix
  18. fi
  19. TK_SRC_DIR=`cd $srcdir/..; pwd`
  20.  
  21. AC_PROG_RANLIB
  22. AC_ARG_ENABLE(gcc, [  --enable-gcc            allow use of gcc if available],
  23.     [tk_ok=$enableval], [tkl_ok=no])
  24. if test "$tk_ok" = "yes"; then
  25.     AC_PROG_CC
  26. else
  27.     CC=${CC-cc}
  28. AC_SUBST(CC)
  29. fi
  30. AC_C_CROSS
  31. AC_HAVE_HEADERS(unistd.h limits.h)
  32.  
  33. #--------------------------------------------------------------------
  34. #    See if there was a command-line option for where Tcl is;  if
  35. #    not, assume that its top-level directory is a sibling of ours.
  36. #--------------------------------------------------------------------
  37.  
  38. AC_ARG_WITH(tcl, [  --with-tcl=DIR          use Tcl 8.0 binaries from DIR],
  39.     TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd ../../tcl8.0/unix; pwd`)
  40. if test ! -d $TCL_BIN_DIR; then
  41.     AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR doesn't exist)
  42. fi
  43. if test ! -f $TCL_BIN_DIR/Makefile; then
  44.     AC_MSG_ERROR(There's no Makefile in $TCL_BIN_DIR;  perhaps you didn't specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?)
  45. fi
  46.  
  47. #--------------------------------------------------------------------
  48. #    Read in configuration information generated by Tcl for shared
  49. #    libraries, and arrange for it to be substituted into our
  50. #    Makefile.
  51. #--------------------------------------------------------------------
  52.  
  53. file=$TCL_BIN_DIR/tclConfig.sh
  54. . $file
  55. SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
  56. SHLIB_LD=$TCL_SHLIB_LD
  57. SHLIB_LD_LIBS=$TCL_SHLIB_LD_LIBS
  58. SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
  59. SHLIB_VERSION=$TCL_SHLIB_VERSION
  60. DL_LIBS=$TCL_DL_LIBS
  61. LD_FLAGS=$TCL_LD_FLAGS
  62.  
  63. LIB_RUNTIME_DIR='${LIB_RUNTIME_DIR}'
  64.  
  65. # If Tcl and Tk are installed in different places, adjust the library
  66. # search path to reflect this.
  67.  
  68. if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then
  69.     LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}"
  70. fi
  71.  
  72. #--------------------------------------------------------------------
  73. #    Supply a substitute for stdlib.h if it doesn't define strtol,
  74. #    strtoul, or strtod (which it doesn't in some versions of SunOS).
  75. #--------------------------------------------------------------------
  76.  
  77. AC_MSG_CHECKING(stdlib.h)
  78. AC_HEADER_EGREP(strtol, stdlib.h, tk_ok=yes, tk_ok=no)
  79. AC_HEADER_EGREP(strtoul, stdlib.h, , tk_ok=no)
  80. AC_HEADER_EGREP(strtod, stdlib.h, , tk_ok=no)
  81. if test $tk_ok = no; then
  82.     AC_DEFINE(NO_STDLIB_H)
  83. fi
  84. AC_MSG_RESULT($tk_ok)
  85.  
  86. #--------------------------------------------------------------------
  87. #    Include sys/select.h if it exists and if it supplies things
  88. #    that appear to be useful and aren't already in sys/types.h.
  89. #    This appears to be true only on the RS/6000 under AIX.  Some
  90. #    systems like OSF/1 have a sys/select.h that's of no use, and
  91. #    other systems like SCO UNIX have a sys/select.h that's
  92. #    pernicious.  If "fd_set" isn't defined anywhere then set a
  93. #    special flag.
  94. #--------------------------------------------------------------------
  95.  
  96. AC_MSG_CHECKING([fd_set and sys/select])
  97. AC_TRY_COMPILE([#include <sys/types.h>],
  98.     [fd_set readMask, writeMask;], tk_ok=yes, tk_ok=no)
  99. if test $tk_ok = no; then
  100.     AC_HEADER_EGREP(fd_mask, sys/select.h, tk_ok=yes)
  101.     if test $tk_ok = yes; then
  102.     AC_DEFINE(HAVE_SYS_SELECT_H)
  103.     fi
  104. fi
  105. AC_MSG_RESULT($tk_ok)
  106. if test $tk_ok = no; then
  107.     AC_DEFINE(NO_FD_SET)
  108. fi
  109.  
  110. #--------------------------------------------------------------------
  111. #    Check for various typedefs and provide substitutes if
  112. #    they don't exist.
  113. #--------------------------------------------------------------------
  114.  
  115. AC_MODE_T
  116. AC_PID_T
  117. AC_SIZE_T
  118. AC_UID_T
  119.  
  120. #------------------------------------------------------------------------------
  121. #       Find out about time handling differences.
  122. #------------------------------------------------------------------------------
  123.  
  124. AC_CHECK_HEADERS(sys/time.h)
  125. AC_HEADER_TIME
  126.  
  127. #--------------------------------------------------------------------
  128. #    Locate the X11 header files and the X11 library archive.  Try
  129. #    the ac_path_x macro first, but if it doesn't find the X stuff
  130. #    (e.g. because there's no xmkmf program) then check through
  131. #    a list of possible directories.  Under some conditions the
  132. #    autoconf macro will return an include directory that contains
  133. #    no include files, so double-check its result just to be safe.
  134. #--------------------------------------------------------------------
  135.  
  136. AC_PATH_X
  137. not_really_there=""
  138. if test "$no_x" = ""; then
  139.     if test "$x_includes" = ""; then
  140.     AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
  141.     else
  142.     if test ! -r $x_includes/X11/Intrinsic.h; then
  143.         not_really_there="yes"
  144.     fi
  145.     fi
  146. fi
  147. if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
  148.     AC_MSG_CHECKING(for X11 header files)
  149.     XINCLUDES="# no special path needed"
  150.     AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
  151.     if test "$XINCLUDES" = nope; then
  152.         dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include"
  153.         for i in $dirs ; do
  154.         if test -r $i/X11/Intrinsic.h; then
  155.         AC_MSG_RESULT($i)
  156.             XINCLUDES=" -I$i"
  157.         break
  158.         fi
  159.         done
  160.     fi
  161. else
  162.     if test "$x_includes" != ""; then
  163.     XINCLUDES=-I$x_includes
  164.     else
  165.     XINCLUDES="# no special path needed"
  166.     fi
  167. fi
  168. if test "$XINCLUDES" = nope; then
  169.     AC_MSG_RESULT(couldn't find any!)
  170.     XINCLUDES="# no include files found"
  171. fi
  172.  
  173. if test "$no_x" = yes; then
  174.     AC_MSG_CHECKING(for X11 libraries)
  175.     XLIBSW=nope
  176.     dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
  177.     for i in $dirs ; do
  178.     if test -r $i/libX11.a -o -r $i/libX11.so -o -r $i/libX11.sl; then
  179.         AC_MSG_RESULT($i)
  180.         XLIBSW="-L$i -lX11"
  181.         x_libraries="$i"
  182.         break
  183.     fi
  184.     done
  185. else
  186.     if test "$x_libraries" = ""; then
  187.     XLIBSW=-lX11
  188.     else
  189.     XLIBSW="-L$x_libraries -lX11"
  190.     fi
  191. fi
  192. if test "$XLIBSW" = nope ; then
  193.     AC_CHECK_LIB(Xwindow, XCreateWindow, XLIBSW=-lXwindow)
  194. fi
  195. if test "$XLIBSW" = nope ; then
  196.     AC_MSG_RESULT(couldn't find any!  Using -lX11.)
  197.     XLIBSW=-lX11
  198. fi
  199.  
  200. #--------------------------------------------------------------------
  201. #    Various manipulations on the search path used at runtime to
  202. #    find shared libraries:
  203. #    1. If the X library binaries are in a non-standard directory,
  204. #       add the X library location into that search path.
  205. #    2. On systems such as AIX and Ultrix that use "-L" as the
  206. #       search path option, colons cannot be used to separate
  207. #       directories from each other. Change colons to " -L".
  208. #    3. Create two sets of search flags, one for use in cc lines
  209. #       and the other for when the linker is invoked directly.  In
  210. #       the second case, '-Wl,' must be stripped off and commas must
  211. #       be replaced by spaces.
  212. #--------------------------------------------------------------------
  213.  
  214. if test "x${x_libraries}" != "x"; then
  215.     LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}"
  216. fi
  217. if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then
  218.     LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'`
  219. fi
  220. eval "TK_CC_SEARCH_FLAGS=\"$TCL_LD_SEARCH_FLAGS\""
  221. TK_LD_SEARCH_FLAGS=`echo ${TK_CC_SEARCH_FLAGS} |sed -e "s|-Wl,||g" -e "s|,| |g"`
  222.  
  223. #--------------------------------------------------------------------
  224. #    Check for the existence of various libraries.  The order here
  225. #    is important, so that then end up in the right order in the
  226. #    command line generated by make.  The -lsocket and -lnsl libraries
  227. #    require a couple of special tricks:
  228. #    1. Use "connect" and "accept" to check for -lsocket, and
  229. #       "gethostbyname" to check for -lnsl.
  230. #    2. Use each function name only once:  can't redo a check because
  231. #       autoconf caches the results of the last check and won't redo it.
  232. #    3. Use -lnsl and -lsocket only if they supply procedures that
  233. #       aren't already present in the normal libraries.  This is because
  234. #       IRIX 5.2 has libraries, but they aren't needed and they're
  235. #       bogus:  they goof up name resolution if used.
  236. #    4. On some SVR4 systems, can't use -lsocket without -lnsl too.
  237. #       To get around this problem, check for both libraries together
  238. #       if -lsocket doesn't work by itself.
  239. #--------------------------------------------------------------------
  240.  
  241. AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"])
  242.  
  243. tk_checkBoth=0
  244. AC_CHECK_FUNC(connect, tk_checkSocket=0, tk_checkSocket=1)
  245. if test "$tk_checkSocket" = 1; then
  246.     AC_CHECK_LIB(socket, main, LIBS="$LIBS -lsocket", tk_checkBoth=1)
  247. fi
  248. if test "$tk_checkBoth" = 1; then
  249.     tk_oldLibs=$LIBS
  250.     LIBS="$LIBS -lsocket -lnsl"
  251.     AC_CHECK_FUNC(accept, tk_checkNsl=0, [LIBS=$tk_oldLibs])
  252. fi
  253. AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main, [LIBS="$LIBS -lnsl"]))
  254.  
  255. #--------------------------------------------------------------------
  256. # One more check related to the X libraries.  The standard releases
  257. # of Ultrix don't support the "xauth" mechanism, so send won't work
  258. # unless TK_NO_SECURITY is defined.  However, there are usually copies
  259. # of the MIT X server available as well, which do support xauth.
  260. # Check for the MIT stuff and use it if it exists.
  261. #
  262. # Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1)
  263. # because it can't deal with the "-" in the library name.
  264. #--------------------------------------------------------------------
  265.  
  266. if test -d /usr/include/mit ; then
  267.     AC_MSG_CHECKING([MIT X libraries])
  268.     tk_oldCFlags=$CFLAGS
  269.     CFLAGS="$CFLAGS -I/usr/include/mit"
  270.     tk_oldLibs=$LIBS
  271.     LIBS="$LIBS -lX11-mit"
  272.     AC_TRY_LINK([
  273.     #include <X11/Xlib.h>
  274.     ], [
  275.     XOpenDisplay(0);
  276.     ], [
  277.     AC_MSG_RESULT(yes)
  278.     XLIBSW="-lX11-mit"
  279.     XINCLUDES="-I/usr/include/mit"
  280.     ], AC_MSG_RESULT(no))
  281.     CFLAGS=$tk_oldCFlags
  282.     LIBS=$tk_oldLibs
  283. fi
  284.  
  285. #--------------------------------------------------------------------
  286. #    On a few very rare systems, all of the libm.a stuff is
  287. #    already in libc.a.  Set compiler flags accordingly.
  288. #    Also, Linux requires the "ieee" library for math to
  289. #    work right (and it must appear before "-lm").
  290. #--------------------------------------------------------------------
  291.  
  292. MATH_LIBS=""
  293. AC_CHECK_FUNC(sin, , MATH_LIBS="-lm")
  294. AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"])
  295.  
  296. #--------------------------------------------------------------------
  297. #    If this system doesn't have a memmove procedure, use memcpy
  298. #    instead.
  299. #--------------------------------------------------------------------
  300.  
  301. AC_CHECK_FUNC(memmove, , [AC_DEFINE(memmove, memcpy)])
  302.  
  303. #--------------------------------------------------------------------
  304. #    Figure out whether "char" is unsigned.  If so, set a
  305. #    #define for __CHAR_UNSIGNED__.
  306. #--------------------------------------------------------------------
  307.  
  308. AC_C_CHAR_UNSIGNED
  309.  
  310. #--------------------------------------------------------------------
  311. #    Under Solaris 2.4, strtod returns the wrong value for the
  312. #    terminating character under some conditions.  Check for this
  313. #    and if the problem exists use a substitute procedure
  314. #    "fixstrtod" (provided by Tcl) that corrects the error.
  315. #--------------------------------------------------------------------
  316.  
  317. AC_CHECK_FUNC(strtod, tk_strtod=1, tk_strtod=0)
  318. if test "$tk_strtod" = 1; then
  319.     AC_MSG_CHECKING([for Solaris 2.4 strtod bug])
  320.     AC_TRY_RUN([
  321.     extern double strtod();
  322.     int main()
  323.     {
  324.         char *string = "NaN";
  325.         char *term;
  326.         strtod(string, &term);
  327.         if ((term != string) && (term[-1] == 0)) {
  328.         exit(1);
  329.         }
  330.         exit(0);
  331.     }], tk_ok=1, tk_ok=0, tk_ok=0)
  332.     if test "$tk_ok" = 1; then
  333.     AC_MSG_RESULT(ok)
  334.     else
  335.     AC_MSG_RESULT(buggy)
  336.     AC_DEFINE(strtod, fixstrtod)
  337.     fi
  338. fi
  339.  
  340. #--------------------------------------------------------------------
  341. #    The statements below define a collection of symbols related to
  342. #    building libtk as a shared library instead of a static library.
  343. #--------------------------------------------------------------------
  344.  
  345. AC_ARG_ENABLE(shared,
  346.     [  --enable-shared         build libtk as a shared library],
  347.     [ok=$enableval], [ok=no])
  348. if test "$ok" = "yes" -a "${SHLIB_SUFFIX}" != ""; then
  349.     TK_SHARED_BUILD=1
  350.     TK_SHLIB_CFLAGS="${SHLIB_CFLAGS}"
  351.     eval "TK_LIB_FILE=libtk${TCL_SHARED_LIB_SUFFIX}"
  352.     MAKE_LIB="\${SHLIB_LD} -o ${TK_LIB_FILE} \${OBJS} \$(TK_LD_SEARCH_FLAGS) ${SHLIB_LD_LIBS}"
  353.     RANLIB=":"
  354. else
  355.     TK_SHARED_BUILD=0
  356.     TK_SHLIB_CFLAGS=""
  357.     eval "TK_LIB_FILE=libtk${TCL_UNSHARED_LIB_SUFFIX}"
  358.     MAKE_LIB="ar cr ${TK_LIB_FILE} \${OBJS}"
  359. fi
  360.  
  361. # Note:  in the following variable, it's important to use the absolute
  362. # path name of the Tcl directory rather than "..":  this is because
  363. # AIX remembers this path and will attempt to use it at run-time to look
  364. # up the Tcl library.
  365.  
  366. if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
  367.     TK_BUILD_LIB_SPEC="-L`pwd` -ltk${VERSION}"
  368.     TK_LIB_SPEC="-L${exec_prefix}/lib -ltk${VERSION}"
  369. else
  370.     TK_BUILD_LIB_SPEC="-L`pwd` -ltk`echo ${VERSION} | tr -d .`"
  371.     TK_LIB_SPEC="-L${exec_prefix}/lib -ltk`echo ${VERSION} | tr -d .`"
  372. fi
  373.  
  374. AC_SUBST(DL_LIBS)
  375. AC_SUBST(LD_FLAGS)
  376. AC_SUBST(MATH_LIBS)
  377. AC_SUBST(MAKE_LIB)
  378. AC_SUBST(SHLIB_CFLAGS)
  379. AC_SUBST(SHLIB_LD)
  380. AC_SUBST(SHLIB_LD_LIBS)
  381. AC_SUBST(SHLIB_SUFFIX)
  382. AC_SUBST(SHLIB_VERSION)
  383. AC_SUBST(TCL_BIN_DIR)
  384. AC_SUBST(TCL_BUILD_LIB_SPEC)
  385. AC_SUBST(TCL_SRC_DIR)
  386. AC_SUBST(TCL_VERSION)
  387. AC_SUBST(TK_BUILD_LIB_SPEC)
  388. AC_SUBST(TK_CC_SEARCH_FLAGS)
  389. AC_SUBST(TK_LD_SEARCH_FLAGS)
  390. AC_SUBST(TK_LIB_FILE)
  391. AC_SUBST(TK_LIB_SPEC)
  392. AC_SUBST(TK_MAJOR_VERSION)
  393. AC_SUBST(TK_MINOR_VERSION)
  394. AC_SUBST(TK_PATCH_LEVEL)
  395. AC_SUBST(TK_SHLIB_CFLAGS)
  396. AC_SUBST(TK_SRC_DIR)
  397. AC_SUBST(TK_VERSION)
  398. AC_SUBST(XINCLUDES)
  399. AC_SUBST(XLIBSW)
  400. AC_SUBST(TK_SHARED_BUILD)
  401.  
  402. AC_OUTPUT(Makefile tkConfig.sh)
  403.